<div class="model_actions_toolbar">
    <?php $this->widget('backend.components.ModelActions'); ?>
</div>

<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->baseUrl; ?>/assets/backend/books.css" />

<div class="book">
    <div class="title">
        <?php echo CHtml::encode($book->name); ?>
    </div>
    <div class="book_infos">
        <div class="cover" id="book_cover">
            <?php echo CHtml::link(CHtml::image($book->coverSource, $book->name), array('viewChapterContents', 'bid' => $book->id)); ?>
        </div>
        <div style="float: left; padding-left: 20px;">
            <p>Posted at <?php echo date('Y-m-d H:m:s', $book->created); ?></p>
            <p>
                <?php echo Yii::t('book', 'author'); ?>: <?php echo $book->author; ?>
                <span></span>
                <?php echo Yii::t('book', 'published_unit'); ?>: <?php echo $book->published_unit; ?>
            </p>
        </div>
    </div>
    <div class="book_summary">
        <?php
        $this->beginWidget('CMarkdown', array('purifyOutput' => true));
        echo CUtil::substr(CModifier::Html2Text($book->summary, 1), 300);
        $this->endWidget();
        ?>
    </div>
    <div class="box">
        <div class="chapter_trees">
            <?php
            $this->widget('CTreeView', array(
                'persist' => 'cookie', 'data' => $chapter_trees, 'animated' => 'fast', 'htmlOptions' => array(
                    'id' => 'treeview', 'class' => 'filetree treeview-red'
                )
            ));
            ?>
        </div>
        <div class="chapter_form">
            <!-- begin -->
            <div style="">
                <?php
                echo CHtml::beginForm(array('view',
                    'bid' => Yii::app()->request->getParam('bid'),
                    'node' => Yii::app()->request->getParam('node')),
                    'post'
                );
                echo CHtml::submitButton(Yii::t('book', 'add_chapter_category'), array('class' => 'btn'));
                echo CHtml::endForm();
                ?>
            </div>

            <div class="commend" style="clear: both;">
                <?php if (Yii::app()->user->hasFlash('add_chapter_category_success')): ?>
                <div class="success">
                    <?php echo Yii::app()->user->getFlash('add_chapter_category_success'); ?>
                </div>
                <?php elseif (Yii::app()->user->hasFlash('update_chapter_category_success')): ?>
                <div class="success">
                    <?php echo Yii::app()->user->getFlash('update_chapter_category_success'); ?>
                </div>
                <?php endif; ?>
                <?php
                $this->renderPartial('/books/_chapterCategory',array(
                    'category' => $category
                ));
                ?>
            </div>
            <!-- //end -->
        </div>
    </div>
</div>
